package net.lzzy;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class MappingTables {
    public static void main(String[] args) {
        Map<String,Student> stu = new HashMap<>();
        Student s1 = new Student("刘瘸子","大数据1",55);
        Student s2 = new Student("马骝子","大数据1",90);
        Student s3 = new Student("王狗子","大数据1",77);
        stu.put("2001",s1);
        stu.put("2002",s2);
        stu.put("2003",s3);

        Set<String> sk = stu.keySet();
        for (String s:sk){
            Student stud = stu.get(s);
            System.out.println(stud+" 学号:"+s);
        }

        stu.forEach(
                (studen,id)-> System.out.println("学号："+studen+" "+id)
        );


        Scanner scan = new Scanner(System.in);
        System.out.print("请输入学号:");
        String id = scan.nextLine();
        System.out.println(stu.get(id));

    }
}

